package tas.co.in.controller.employees;

import java.util.List;
import java.util.StringTokenizer;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import tas.co.in.dao.employees.cce_status_interface;
import tas.co.in.domain.employees.cce_status_bean;

public class cceController extends MultiActionController 
{
	private cce_status_interface cceStatus;

	/**
	 * @param cceStatus the cceStatus to set
	 */
	public void setCceStatus(cce_status_interface cceStatus) {
		this.cceStatus = cceStatus;
	}
	
	public ModelAndView prashant(HttpServletRequest request,
			HttpServletResponse response)
	{
		
		HttpSession session=request.getSession(true);
		  
		  cce_status_bean cceBean=new cce_status_bean();
		  
		  cceBean.setExtention(request.getParameter("ex"));
		  cceBean.setCce_ip_address(request.getParameter("ip"));
		  cceBean.setEmpId(session.getAttribute("userId").toString());
//		  System.out.println(request.getParameter("ip"));
		
		cce_status_bean resultlist=cceStatus.validateCCeStatus(cceBean);
		
		
		return new ModelAndView("sharedJSP/cceStatus", "resultObject",
				resultlist);
		
	}
	
	public ModelAndView getEmployeeByCity(HttpServletRequest request,
			HttpServletResponse response)
	{
		cce_status_bean cceBean=new cce_status_bean();
		cceBean.setEmpCity(request.getParameter("city"));
		
		List<cce_status_bean> resultlist=cceStatus.getEmployeeByCity(cceBean);
		
		
		return new ModelAndView("employee/empByCity","resultObject",resultlist);
	
	}
	
	public ModelAndView getCCEUpdate(HttpServletRequest request, HttpServletResponse response)
	{
		List<cce_status_bean> resultObject = cceStatus.getUpdate();
		return new ModelAndView("employee/empByCity", "resultObject", resultObject);
	}
	
	public ModelAndView statusUpdate(HttpServletRequest request, HttpServletResponse response)
	{
		StringTokenizer items = new StringTokenizer(request.getParameter("customerissue"), ",");
		
		boolean resultObject = cceStatus.setUpdate(items);		
		
		return new ModelAndView("sharedJSP/BooleanResults","resultObject",resultObject);
	}

}
